package Timer;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created with IntelliJ IDEA
 * Description:标准库中timer的使用方式
 * User:34398
 * Date:2024-07-28
 * Time:10:30
 */
public class test1j {
    public static void main(String[] args) {


        /**设计一个延迟三秒执行的程序*/
        Timer timer=new Timer(true  );

        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("hello world");
            }
        },1000);

        System.out.println("程序开始运行");

    }
}
